#include "QpwDecorationObject.h"

using namespace QpwWorld;

DecorationObject::DecorationObject( const QpwSubType & subType,
    const QpwStyleDatabase & styleDatabase, const QpwGeometryDatabase & geometryDatabase )
{

    p_revision = 0;
    p_subType = subType;
    if ( styleDatabase.rows.contains(subType.styleUuid) )
        p_style = styleDatabase.rows[subType.styleUuid];
    p_health = subType.health;
    if ( geometryDatabase.rows.contains(subType.geometryUuid) )
        p_geometry = geometryDatabase.rows[subType.geometryUuid];
    p_eventProcessorType = subType.eventProcessorType;
    p_destroyProcessorType = subType.destroyProcessorType;

}

DecorationObject::~DecorationObject() {
}

bool DecorationObject::isValid() const {

    return p_subType.isValid() && p_style.isValid() && p_geometry.count();
}

/*static */QString DecorationObject::typeName( quint32 type ) {

    switch (type) {

    case DecorationObjectType:
        return QString("Decoration");

    case StaticObjectType:
        return QString("Static");

    case QuasiStaticObjectType:
        return QString("Quasi static");

    case DynamicObjectType:
        return QString("Dynamic");

    }

    return QString();
}
